//object interface
interface Point{
    x:number;
    y:number;
}

let point:Point = {
    x:2,
    y:1
};

interface Remark{
    name:string;
    age?:number;
    readonly gender:string;
    [propName:string]:any;
}

let remark:Remark = {
    name:'Tom',
    gender:'male',
    hobby:'football'
};
remark.name='Bob';
remark.hobby='basketball';
remark.info=null;
console.log(remark);

//function interface
interface Calculate{
    add(x:number,y:number):number;
}
const f=function(x:number,y:number):number{
    return x+y;
};

interface Calculate2{
    add:(x:number,y:number)=>number;
}
const f2=(x:number,y:number)=>x+y;

//iterator interface
interface CustomArray{
    [index:number]:string;
}
let array:CustomArray=['typescript','javascript'];

interface CustomObject{
    [index:string]:number;
}
let object:CustomObject={a:1,b:2};

//inherit
interface BigPoint extends Point,Remark{}

//hybrid interface
interface Counter{
    (start:number):string;
    interval:number;
    reset():void;
}
function counter():Counter{
    let counter=function(start:number){} as Counter;
    counter.interval=1;
    counter.reset=function(){};
    return counter;
}
